package com.jose.photogallery.domain;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class UploadUtil {

	public static List<String> splitInput(String formInput) {
		List<String> tags = new ArrayList<String>();
		String[] split = formInput.split(",");
		
		for(String s : split) {
			tags.add(s.trim());
		}
		
		return tags;
	}
	
	public static boolean isValidFileType(String contentType) {
		/*
		 * Validate the MIME content-type for the upload blobstore file
		 * Valid MIME content-types:
		 * - image/jpeg
		 * - image/png
		 * - image/gif
		 * - image/tiff
		 * - image/x-icon
		 * - image/bmp
		 */
		List<String> validTypes = Arrays.asList("image/jpeg", "image/png", "image/gif", "image/tiff", "image/x-icon", "image/bmp");
		return validTypes.contains(contentType);
	}
}
